Skip to content

Fix incorrect method call in updateExpTextProcessingTime()#334

Merged
kyteinsky merged 1 commit intonextcloud:mainfrom
IONOS-Productivity:fix/processing_time_exception
Feb 12, 2026
Merged

Fix incorrect method call in updateExpTextProcessingTime()#334
kyteinsky merged 1 commit intonextcloud:mainfrom
IONOS-Productivity:fix/processing_time_exception

Conversation

@printminion-co
Copy link
Contributor

This commit fixes a bug where the method updateExpTextProcessingTime incorrectly called getExpImgProcessingTime. The change ensures that text and image processing times are tracked independently.

Description

Fixes a bug in updateExpTextProcessingTime() where it incorrectly calls getExpImgProcessingTime() instead of getExpTextProcessingTime(). This causes database type conflicts when processing text generation tasks.

The Bug

File: lib/Service/OpenAiAPIService.php
Line: 850

The function reads image processing time configuration when it should read text processing time configuration:

public function updateExpTextProcessingTime(int $runtime): void {
    $oldTime = floatval($this->getExpImgProcessingTime());  // ❌ Wrong method
    // ...
}

This causes a mismatch between:

  • Read: openai_image_generation_time / localai_image_generation_time
  • Write: openai_text_generation_time / localai_text_generation_time

Impact

Error Message

RuntimeException: OpenAI/LocalAI request failed: conflict with value type from database

When it Occurs

  • Background job processing for TaskProcessing text generation tasks
  • All text-based AI operations (FreePrompt, Summary, Headline, etc.)
  • Both OpenAI and LocalAI endpoints affected

Affected Versions

  • Introduced in v3.6.0 (commit e1ffaba - "psalm fixes", April 4, 2025)
  • Present in all subsequent versions through current v4.2.0

The Fix

Change line 850 to call the correct method:

  public function updateExpTextProcessingTime(int $runtime): void {
-     $oldTime = floatval($this->getExpImgProcessingTime());
+     $oldTime = floatval($this->getExpTextProcessingTime());
      $newTime = (1.0 - Application::EXPECTED_RUNTIME_LOWPASS_FACTOR) * $oldTime + Application::EXPECTED_RUNTIME_LOWPASS_FACTOR * floatval($runtime);

Root Cause

Copy-paste error when updateExpTextProcessingTime() was created. The corresponding updateExpImgProcessingTime() method (line 774) correctly calls getExpImgProcessingTime(), but this pattern wasn't updated for the text processing variant.

Testing

The fix ensures:

  1. Text processing time metrics are properly tracked
  2. No database type conflicts when reading/writing config values
  3. Proper exponential moving average calculation for text generation times

Reproduction

  1. Configure LocalAI or OpenAI endpoint
  2. Trigger any text generation task via Assistant
  3. Background job worker processes the task
  4. Error occurs when trying to update processing time metrics

Stack Trace Context

File: /var/www/html/lib/private/TaskProcessing/Manager.php:949
  -> OCA\OpenAi\TaskProcessing\TextToTextProvider->process()

File: /var/www/html/apps-external/integration_openai/lib/TaskProcessing/TextToTextProvider.php:135
  -> RuntimeException: OpenAI/LocalAI request failed: conflict with value type from database

Checklist

  • Bug fix (non-breaking change which fixes an issue)
  • Tested locally
  • One-line change, minimal risk
  • No new dependencies
  • Maintains backward compatibility

@printminion-co printminion-co force-pushed the fix/processing_time_exception branch 2 times, most recently from 58c953d to 59036d5 Compare February 9, 2026 09:09
This commit fixes a bug where the method updateExpTextProcessingTime incorrectly called getExpImgProcessingTime. The change ensures that text and image processing times are tracked independently.

Additionally, unit tests have been added to verify the correct functionality of processing time tracking for both text and image generations.

Signed-off-by: Misha M.-Kupriyanov <kupriyanov@strato.de>
@printminion-co printminion-co force-pushed the fix/processing_time_exception branch from 59036d5 to ba8ad92 Compare February 12, 2026 09:15
Copy link
Contributor

@kyteinsky kyteinsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks!

@kyteinsky kyteinsky merged commit c5f8411 into nextcloud:main Feb 12, 2026
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants